package com.example.springboot3005web.vo;

import jakarta.validation.constraints.*;
import lombok.Data;

@Data
public class ArticleVo {

    public static interface AddArticleGroup{};
    public static interface EditArticleGroup{};

    @NotNull(message = "文章ID不能为空", groups = {EditArticleGroup.class})
    private Integer id;

    @NotNull(message = "必须有作者", groups = {AddArticleGroup.class, EditArticleGroup.class})
    private Integer userId;

    @NotBlank(message = "必须有标题", groups = {AddArticleGroup.class, EditArticleGroup.class})
    @Size(min = 3, max = 60, message = "标题必须3个字以上", groups = {AddArticleGroup.class, EditArticleGroup.class})
    private String title;

    @NotBlank(message = "必须要有副标题", groups = {AddArticleGroup.class, EditArticleGroup.class})
    @Size(min = 8, max = 60, message = "副标题必须8个字以上", groups = {AddArticleGroup.class, EditArticleGroup.class})
    private String summary;

    @DecimalMin(value = "0", message = "已读最小是0", groups = {AddArticleGroup.class, EditArticleGroup.class})
    private Integer readCount;

    @Email(message = "邮箱格式不正确", groups = {AddArticleGroup.class, EditArticleGroup.class})
    private String email;

}
